//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.crux.ribbon;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

public class ServiceLocator {
    private static BeanFactory beanFactory;

    public ServiceLocator() {
    }

    public static <T> T getService(Class<T> requiredType) {
        return beanFactory == null ? null : beanFactory.getBean(requiredType);
    }

    @Component
    @Lazy(false)
    static class Aware implements BeanFactoryAware {
        Aware() {
        }

        public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
            ServiceLocator.beanFactory = beanFactory;
        }
    }
}
